
var app = getApp();

var Auth = app.modules['Auth'];
var Config = app.config;

//CookieName
const COOKIE_NAME = Config.session.cookie_name;

module.exports = {
    before:function(request){
        if(Auth.user() != null){
            var cookies = request.getHeader('Cookie');
            var header = {
                key: 'Cookie',
                value: COOKIE_NAME+'='+Auth.identifier()+';'+cookies
            };
            request.withHeaders(header);
        }
        return true;
    }
}